//
//  ZSY_CHHotCityTableViewCell.m
//  ZSY_BreadTrip
//
//  Created by 张诗宇 on 16/1/13.
//  Copyright © 2016年 张诗宇. All rights reserved.
//

#import "ZSY_CHHotCityTableViewCell.h"

@interface ZSY_CHHotCityTableViewCell ()

@property (nonatomic, retain) ZSY_BaseButton *place;
@property (nonatomic, retain) ZSY_BaseLabel *GPS;
@property (nonatomic, retain) ZSY_BaseLabel *hotPlace;
@property (nonatomic, retain) ZSY_BaseButton *beijing;
@property (nonatomic, retain) ZSY_BaseButton *shanghai;
@property (nonatomic, retain) ZSY_BaseButton *shenzhen;
@property (nonatomic, retain) ZSY_BaseButton *guangzhou;
@property (nonatomic, retain) ZSY_BaseButton *chengdu;
@property (nonatomic, retain) ZSY_BaseButton *wuhan;
@property (nonatomic, retain) ZSY_BaseLabel *allCity;

@end

@implementation ZSY_CHHotCityTableViewCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        [self createSubViews];
    }
    return self;
}


- (void)createSubViews{
    
    self.contentView.backgroundColor = [UIColor colorWithRed:63 / 255.0 green:176 / 255.0 blue:192 / 255.0 alpha:1];
    
    self.place = [ZSY_BaseButton buttonWithType:UIButtonTypeCustom];
    self.place.frame = CGRectMake(20, 20, 40, 20);
    //    self.place.layer.cornerRadius = 18;
    //    self.place.layer.masksToBounds = YES;
    //    self.place.layer.borderWidth = 1;
    //    self.place.layer.borderColor = [[UIColor whiteColor] CGColor];
    [self.place setTitle:@"大连" forState:UIControlStateNormal];
    self.place.backgroundColor = [UIColor colorWithRed:63 / 255.0 green:176 / 255.0 blue:192 / 255.0 alpha:1];
    [self.place setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.place.titleLabel.font = [UIFont systemFontOfSize:13];
    self.place.titleLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:self.place];
    [self.place addTarget:self action:@selector(dalianAction) forControlEvents:UIControlEventTouchUpInside];
    
    
    self.GPS = [[ZSY_BaseLabel alloc] initWithFrame:CGRectMake(60, 20, 100, 20)];
    self.GPS.text = @"GPS 定位";
    self.GPS.textColor = [UIColor whiteColor];
    self.GPS.font = [UIFont systemFontOfSize:13];
    [self.contentView addSubview:self.GPS];
    [_GPS release];
    
    
    self.hotPlace = [[ZSY_BaseLabel alloc] initWithFrame:CGRectMake(20, 50, 100, 20)];
    self.hotPlace.text = @"热门城市";
    self.hotPlace.textColor = [UIColor colorWithRed:63 / 255.0 green:176 / 255.0 blue:192 / 255.0 alpha:1];
    self.hotPlace.font = [UIFont systemFontOfSize:13];
    [self.contentView addSubview:self.hotPlace];
    [_hotPlace release];
    
    
    self.beijing = [ZSY_BaseButton buttonWithType:UIButtonTypeCustom];
    self.beijing.frame = CGRectMake(20, 90, 100, 36);
    self.beijing.layer.cornerRadius = 18;
    self.beijing.layer.masksToBounds = YES;
    self.beijing.layer.borderWidth = 1;
    self.beijing.layer.borderColor = [[UIColor whiteColor] CGColor];
    [self.beijing setTitle:@"北京" forState:UIControlStateNormal];
    self.beijing.backgroundColor = [UIColor colorWithRed:63 / 255.0 green:176 / 255.0 blue:192 / 255.0 alpha:1];
    [self.beijing setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.beijing.titleLabel.font = [UIFont systemFontOfSize:13];
    self.beijing.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.beijing];
    [self.beijing addTarget:self action:@selector(beijingAction) forControlEvents:UIControlEventTouchUpInside];
    
    self.shanghai = [ZSY_BaseButton buttonWithType:UIButtonTypeCustom];
    self.shanghai.frame = CGRectMake(140, 90, 100, 36);
    self.shanghai.layer.cornerRadius = 18;
    self.shanghai.layer.masksToBounds = YES;
    self.shanghai.layer.borderWidth = 1;
    self.shanghai.layer.borderColor = [[UIColor whiteColor] CGColor];
    [self.shanghai setTitle:@"上海" forState:UIControlStateNormal];
    self.shanghai.backgroundColor = [UIColor colorWithRed:63 / 255.0 green:176 / 255.0 blue:192 / 255.0 alpha:1];
    [self.shanghai setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.shanghai.titleLabel.font = [UIFont systemFontOfSize:13];
    self.shanghai.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.shanghai];
    [self.shanghai addTarget:self action:@selector(shanghaiAction) forControlEvents:UIControlEventTouchUpInside];
    
    self.shenzhen = [ZSY_BaseButton buttonWithType:UIButtonTypeCustom];
    self.shenzhen.frame = CGRectMake(260, 90, 100, 36);
    self.shenzhen.layer.cornerRadius = 18;
    self.shenzhen.layer.masksToBounds = YES;
    self.shenzhen.layer.borderWidth = 1;
    self.shenzhen.layer.borderColor = [[UIColor whiteColor] CGColor];
    [self.shenzhen setTitle:@"深圳" forState:UIControlStateNormal];
    self.shenzhen.backgroundColor = [UIColor colorWithRed:63 / 255.0 green:176 / 255.0 blue:192 / 255.0 alpha:1];
    [self.shenzhen setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.shenzhen.titleLabel.font = [UIFont systemFontOfSize:13];
    self.shenzhen.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.shenzhen];
    [self.shenzhen addTarget:self action:@selector(shenzhenAction) forControlEvents:UIControlEventTouchUpInside];
    
    
    self.guangzhou = [ZSY_BaseButton buttonWithType:UIButtonTypeCustom];
    self.guangzhou.frame = CGRectMake(20, 140, 100, 36);
    self.guangzhou.layer.cornerRadius = 18;
    self.guangzhou.layer.masksToBounds = YES;
    self.guangzhou.layer.borderWidth = 1;
    self.guangzhou.layer.borderColor = [[UIColor whiteColor] CGColor];
    [self.guangzhou setTitle:@"广州" forState:UIControlStateNormal];
    self.guangzhou.backgroundColor = [UIColor colorWithRed:63 / 255.0 green:176 / 255.0 blue:192 / 255.0 alpha:1];
    [self.guangzhou setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.guangzhou.titleLabel.font = [UIFont systemFontOfSize:13];
    self.guangzhou.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.guangzhou];
    [self.guangzhou addTarget:self action:@selector(guangzhouAction) forControlEvents:UIControlEventTouchUpInside];
    
    self.chengdu = [ZSY_BaseButton buttonWithType:UIButtonTypeCustom];
    self.chengdu.frame = CGRectMake(140, 140, 100, 36);
    self.chengdu.layer.cornerRadius = 18;
    self.chengdu.layer.masksToBounds = YES;
    self.chengdu.layer.borderWidth = 1;
    self.chengdu.layer.borderColor = [[UIColor whiteColor] CGColor];
    [self.chengdu setTitle:@"成都" forState:UIControlStateNormal];
    self.chengdu.backgroundColor = [UIColor colorWithRed:63 / 255.0 green:176 / 255.0 blue:192 / 255.0 alpha:1];
    [self.chengdu setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.chengdu.titleLabel.font = [UIFont systemFontOfSize:13];
    self.chengdu.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.chengdu];
    [self.chengdu addTarget:self action:@selector(chengduAction) forControlEvents:UIControlEventTouchUpInside];
    
    self.wuhan = [ZSY_BaseButton buttonWithType:UIButtonTypeCustom];
    self.wuhan.frame = CGRectMake(260, 140, 100, 36);
    self.wuhan.layer.cornerRadius = 18;
    self.wuhan.layer.masksToBounds = YES;
    self.wuhan.layer.borderWidth = 1;
    self.wuhan.layer.borderColor = [[UIColor whiteColor] CGColor];
    [self.wuhan setTitle:@"武汉" forState:UIControlStateNormal];
    self.wuhan.backgroundColor = [UIColor colorWithRed:63 / 255.0 green:176 / 255.0 blue:192 / 255.0 alpha:1];
    [self.wuhan setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.wuhan.titleLabel.font = [UIFont systemFontOfSize:13];
    self.wuhan.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.wuhan];
    [self.wuhan addTarget:self action:@selector(wuhanAction) forControlEvents:UIControlEventTouchUpInside];
    
    
    self.allCity = [[ZSY_BaseLabel alloc] initWithFrame:CGRectMake(20, 190, 100, 20)];
    self.allCity.text = @"热门城市";
    self.allCity.textColor = [UIColor colorWithRed:63 / 255.0 green:176 / 255.0 blue:192 / 255.0 alpha:1];
    self.allCity.font = [UIFont systemFontOfSize:13];
    [self.contentView addSubview:self.allCity];
    [_allCity release];
    
}
- (void)dalianAction{
    
    [self.myDelegate getCityName:@"大连"];
}

- (void)beijingAction{
    
    [self.myDelegate getCityName:self.beijing.titleLabel.text];
    //    NSLog(@"北京");
}
- (void)shanghaiAction{
    
    [self.myDelegate getCityName:@"上海"];
    //    NSLog(@"上海");
}
- (void)shenzhenAction{
    
    [self.myDelegate getCityName:@"深圳"];
    //    NSLog(@"深圳");
}
- (void)guangzhouAction{
    
    [self.myDelegate getCityName:@"广州"];
    //    NSLog(@"广州");
}
- (void)chengduAction{
    
    [self.myDelegate getCityName:@"成都"];
    //    NSLog(@"成都");
}
- (void)wuhanAction{
    
    [self.myDelegate getCityName:@"武汉"];
    //    NSLog(@"武汉");
}



@end
